package com.shkmall.system.controller;

import com.shkmall.common.pojo.Result;
import com.shkmall.common.pojo.StatusCode;
import com.shkmall.system.pojo.Admin;
import com.shkmall.system.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/system")
public class AdminController {
    @Autowired
    private AdminService adminService;

    @PostMapping("/add")
    public Result Login(@RequestBody Admin admin){
        if(admin == null){
            return null;
        }
        if(admin.getLoginName()==null || admin.getPassword() == null){
            return null;
        }
        adminService.add(admin);
        return new Result(true, StatusCode.OK,"添加成功");
    }
}
